
from config import STORE_FILE
from test.PyMuPdfReaderTest import loadPdfdata,loadSimpleNode
from llama_index.core.storage.docstore import SimpleDocumentStore

from utils import display_source_node


def adddocs():
    docs = loadPdfdata()
    nodes = loadSimpleNode(docs)
    docstore = SimpleDocumentStore()
    docstore.add_documents(nodes)
    docstore.persist(persist_path=STORE_FILE)

def loadDocs():
    docstore = SimpleDocumentStore.from_persist_path(persist_path=STORE_FILE)
    node= docstore.get_node(node_id='f2426e1d-3e5a-4ee9-9db0-b7ce38b5e77b')
    display_source_node(node, source_length=1500)

if __name__=="__main__":
    loadDocs()


